#!/usr/bin/env python
# -*- coding:utf-8 -*-
# 通过地址判断经纬度

def baidu(name):

    AK = 'rM6pgEkuyMzF2NjXwrb3Zsw4io7sNiAG'
    url = 'http://api.map.baidu.com/geocoding/v3/?address=%s&output=json&ak=%s' % (name, AK)
    import requests
    res = requests.get(url)
    if res.status_code == 200:
        val = res.json()
        if val["status"] == 0:
            return val['result']['location']['lng'],val['result']['location']['lat']
        else:
            return ''
    else:
        return ''